name: Windows MSVC 6.0 build

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  build:
    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v3

    - name: cache toolchain
      id: cache-tc
      uses: actions/cache@v3
      with:
        path: |
          msvc6lt
          vc6varsgh.bat
        key: msvc6lt-cache2

    - name: install toolchain
      if: steps.cache-tc.outputs.cache-hit != 'true'
      run: |
        C:\msys64\usr\bin\wget.exe -q http://mutantstargoat.com/~nuclear/msvc6lt.zip
        7z x msvc6lt.zip
        C:\msys64\usr\bin\wget.exe -q http://mutantstargoat.com/~nuclear/vc6varsgh.bat

    - name: generate makefile
      shell: cmd
      run: |
        call vc6varsgh.bat
        cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=freeglut-instdir .

    - name: build freeglut
      shell: cmd
      run: |
        call vc6varsgh.bat
        nmake

    - name: stage install
      run: cmake --install .

    - uses: actions/upload-artifact@v3
      with:
        name: freeglut-instdir
        path: |
          freeglut-instdir
          bin

# vi:ts=2 sts=2 sw=2 expandtab:
